<?php
$lib_rupiah = new Format_rupiah();
?>

    <div class="member">
            <div class="grid_4 alpha omega">
                <h4>ALAMAT PEMESAN</h4>
                <p> <span> Nama Depan </span> : <b> <?php echo $list_data->nama_depan ?> </b> </p> 
                <p> <span> Nama Belakang </span> : <b><?php echo $list_data->nama_belakang ?> </b></p>
                <p> <span> Provinsi </span> : <b><?php echo $list_data->nama_provinsi1 ?> </b></p>
                <p> <span> Kota</span> : <b><?php echo $list_data->nama_kota1 ?> </b></p>
                <p> <span> Alamat</span> : <b><?php echo $list_data->alamat ?> </b></p>
                <p> <span> Kode Pos</span>: <b><?php echo $list_data->kode_pos ?> </b></p>
                <p> <span> Telp</span> : <b><?php echo $list_data->telp ?> </b></p>
            </div>

            <div class="grid_4">
                <h4>ALAMAT PENGIRIMAN</h4>
                <p> <span> Nama Depan </span> : <b> <?php echo $list_data->nama_depan2 ?> </b> </p> 
                <p> <span> Nama Belakang </span> : <b><?php echo $list_data->nama_belakang2 ?> </b></p>
                <p> <span> Provinsi </span> : <b><?php echo $list_data->nama_provinsi2 ?> </b></p>
                <p> <span> Kota</span> : <b><?php echo $list_data->nama_kota2 ?> </b></p>
                <p> <span> Alamat</span> : <b><?php echo $list_data->alamat2 ?> </b></p>
                <p> <span> Kode Pos</span>: <b><?php echo $list_data->kode_pos2 ?> </b></p>
                <p> <span> Telp</span> : <b><?php echo $list_data->telp2 ?> </b></p>
            </div>

            <div class="grid_4 alpha omega">
                <h4>INFORMASI RETUR BARANG</h4>

                <?php
                $id_retur = $list_data->retur_id;
                $id_transaksi = $list_data->id;
                ?>


                <p> <span> Retur ID</span> : <b><?php echo $list_data->retur_id ?> </b></p>
                <p> <span> Tanggal Retur</span> : <b><?php echo $list_data->tgl_retur ?> </b></p>
                <br/>

                <p> <span> Order ID</span> : <b><?php echo $list_data->id; ?> </b></p>
                <p> <span> Tanggal Transaksi</span> : <b><?php echo $list_data->date ?> </b></p>

                <br/>

                <?php
                $status = "";
                if ($list_data->status_retur == 2)
                    $status = "Sukses";
                else if ($list_data->status_retur == 1)
                    $status = "Gagal";
                else {
                    $tgl1 = date('Y-m-d'); // 1 Oktober 2010

                    $pecah1 = explode("-", $tgl1);
                    $date1 = $pecah1[2];
                    $month1 = $pecah1[1];
                    $year1 = $pecah1[0];

                    $tgl2 = $list_data->tgl_retur; // 10 Oktober 2010
                    $date2 = substr($tgl2, 8, 2);
                    $month2 = substr($tgl2, 5, 2);
                    $year2 = substr($tgl2, 0, 4);

                    $jd1 = GregorianToJD($month1, $date1, $year1);
                    $jd2 = GregorianToJD($month2, $date2, $year2);

                    //pengurangan jadi nilai hari
                    $selisih = $jd1 - $jd2;

                    if ($selisih <= 7)
                        $status = "Proses";
                    else
                        $status = "Gagal";
                }
                ?>
                <p> <span> Retur Status</span> : <b><?php echo $status ?> </b></p>
            </div>


            <div class="clear"></div>
            <br/>
            <p>
                <b>Komentar seputar pemesanan anda :</b> <br/>

                <label>

                    <textarea cols="70" rows="4"  id="komentar" name="komentar" readonly><?php echo $list_data->komentar ?></textarea>

                </label>


            </p> <br/>


            <table>
                <tr>
                    <th style="width: 330px;"> Nama Produk </th>
                    <th style="width: 50px; "> Bny</th>
                    <th style="width: 300px; vertical-align:middle ;"> Alasan Retur Barang </th>
                </tr> 
                <?php
                $lib_rupiah = new Format_rupiah();
                $lib_img = new images_thumb();
                $x = 0;
                echo "<input type='hidden' name='id_transaksi' value='$id_transaksi'/>";
                foreach ($list_data_det as $dta_det) {
                    $x++;
                    $gambar = base_url() . "uploads/" . $dta_det->id_produk . "/" . $lib_img->image($dta_det->image1);
                    echo "<tr class='biaya' >";
                    echo "<td style='vertical-align: middle; text-align:center;'>
                            <img src='$gambar' width='100' align='left' style='margin-right:5px;'/> 
                            <p style='text-align:left;'> Kode Produk : <b>$dta_det->id_produk</b> <br/> 
                            Ukuran Produk : <b>$dta_det->size_produk</b> <br/> 
                            Warna Produk : <b>$dta_det->warna</b> <br/> 
                            </p> <br/></td>";
                    echo "<td style='vertical-align: middle; text-align:center;'> <p> <b> $dta_det->bny </b> </p> </td>";
                    echo "<td style='vertical-align: middle; text-align:center;'> <textarea cols='50' rows='4' readonly>$dta_det->alasan</textarea></td>";

                    echo "</tr>";
                }
                ?>

            </table>
            <?php
            echo anchor("admin_retur/", "   Kembali   ", "class='button' style='color:#f8f8f8'");

            if ($status == "Proses") {
                echo anchor("admin_retur/update_status/$id_retur/1", "   Gagalkan Retur  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8''");

                echo anchor("admin_retur/update_status/$id_retur/2", "   Retur Diterima   ", "class='button' style='float:right; color:#f8f8f8''");
            } else if ($status == "Gagal") {
                echo anchor("admin_retur/update_status/$id_retur/0", "   Ubah Status Proses  ", "class='button' style='float:right;color:#f8f8f8'; margin-left:5px;'");
            } else if ($status == "Sukses") {
                echo anchor("admin_retur/update_status/$id_retur/1", "   Gagalkan Retur  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8''");
                echo anchor("admin_retur/update_status/$id_retur/0", "   Ubah Status Proses  ", "class='button' style='float:right; margin-left:5px; color:#f8f8f8''");
            }
            ?>

            <br/><br/>



   

    <div class="clear"></div>  


</div>

